<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('plans', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('description');
            $table->tinyInteger('duration')->comment('in days');
            $table->integer('price');
            $table->timestamps();
        });

        DB::table('plans')->insert([
            [
                'name' => 'Basic Plan',
                'description' => 'Basic plan for users',
                'duration' => 30,
                'price' => 100
            ],
            [
                'name' => 'Premium Plan',
                'description' => 'Premium plan for users',
                'duration' => 60,
                'price' => 200
            ],
            [
                'name' => 'Ultimate Plan',
                'description' => 'Ultimate plan for users',
                'duration' => 90,
                'price' => 300
            ]
        ]);

    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('plans');
    }
};
